#pragma once
#ifndef OBR_LAUNCHDS_H
#define OBR_LAUNCHDS_H

#include "DScommon.h"
#include "InteractionData.h"
#include "LightData.h"

namespace OBR
{

struct Params
{
    OptixTraversableHandle handle;
    uint subframe_index;
    uint width;
    uint height;
    uint samples_per_launch;
    uint num_fbos;
    float tmin, tmax;
    unsigned long long launch_time;
    /* ----------------------------- light info ----------------------------- */
    int num_total_lights;
    LightInfo *light_desc;
    /* --------------------------- pre alloced buffers -------------------------- */
    // fbo table (size: [width * height * num_fbos])
    Spectrum *fbo;
    /* -------------------------- callable offset info -------------------------- */
    uint material_base_offset;
    uint medium_base_offset;
};

struct SamplePRD
{
    /* ------------------------------ input params ------------------------------ */
    Params *params;     // points to input params
    uint3 launch_index; // the optix launch index
    float scene_time;
    /* --------------------------------- states --------------------------------- */
    curandState_t *rng;
    curandStatePhilox4_32_10_t *rng_long;
    InteractionData inter; // surface interaction info
    Spectrum bg_radiance;  // set by miss program
    /* ----------------------------- occlusion test ----------------------------- */
    Spectrum tr; // transmitance
    /* ---------------------------------- flags --------------------------------- */
    bool consider_medium;    // set by integrator
    bool ray_occlusion_test; // if this is an occlusion ray
    bool log;                // if shader should print log
    bool hit;                // record is this ray hit anything
};

} // namespace OBR

#endif